/**
 * 标准类型定义文件
 * 张勇 41204@qq.com
 */

#include "bit_stream.h"

std_err_t bit_stream_append(bit_stream_t* bits, uint8_t bit) {
	if(bits->bitc >= bits->size) { return STD_ERR_BUFFER_OVERFLOW; }
	bit = bit ? 1 : 0;
	bits->bytes[bits->bitc >> 3] |= bit << (bits->bitc & 7);
	bits->bitc++;
	return STD_ERR_OK;
}
